#include <iostream>
#include "fmtlog.h"
#include "BinanceData.h"
#include "BinanceTrade.h"
#include "BinanceAccount.h"
#include "BinanceTriangle.h"

int main(){
    fmtlog::setLogFile("log_minitor.txt");
	fmtlog::setLogLevel(fmtlog::DBG);
	fmtlog::startPollingThread(1000000);

    // 肯尼亚账号
    std::string apiKey = "W1Z5h7RydJ8CNI40azIXOJKVudRLfawy3k8jEdbh0sfU74yHQzVr5a78IU2E2lRV";
    std::string secretKey = "ZMvkc39AOccvuxLnREzFPx7UZY11grocC08qO8R1lSe7L5yGyyZyq4WlwxF0u0gr";
    // zhanggang
    // std::string apiKey = "bOWuVDgNOF4nzUnRDkAqwHHotZfIeTCEp7Ml8c19usWtVSDYboDu3z2QYwwPJtFJ";
    // std::string secretKey = "kqFeEFS3ZPmiiAu68aBzsUcHNJMJK9uBD86NFg8L21lQwVvIGUPz70yGQj0qVfHn";
    BinanceData* dataPtr = BinanceData::getInstance();
    BinanceTrade* tradePtr = BinanceTrade::getInstance(apiKey,secretKey);
    BinanceAccount* accountPtr = BinanceAccount::getInstance(apiKey,secretKey);
    BinanceTriangle* triangle = BinanceTriangle::getInstance(apiKey,secretKey);

    std::thread data(&BinanceData::connect,dataPtr);
    std::thread trade(&BinanceTrade::connect,tradePtr);
    std::thread account(&BinanceAccount::connect,accountPtr);
    std::thread check(&BinanceTriangle::checkArbitrage,triangle);

    data.join();
    trade.join();
    account.join();
    check.join();
    return 0;
}